<?php

/**
 * 返回消息
 * @author lovebing <lovebing365@126.com> Created on 2015-4-12
 */
class ResponseMessage {

    private $msg = array();
    private $errmsg = '';
    private $dataArr = array();

    /**
     * 
     * @param type $appid
     * @param type $appsecret
     * @param type $verifyTicket
     */
    public function __construct() {   
        $this->msg['return_code'] = '0';
        $this->msg['err_code_des'] = array();             
    }

    public function addErrorMessage($errmsg) {
        $this->msg['return_code'] = 'FAIL';
        $this->msg['err_code_des'][] = $errmsg;
    }   
    /*
     * 判断是否出错
     */
    public function hasError() {
        return $this->msg['return_code'] != '0';
    }      

     /*
     * 判断是否出错
     */
    public function getErrorString() {
        $resultStr = '';
        if($this->hasError())
        {
            $resultStr = implode(',',$this->msg['err_code_des']);          
        }
        
        return $resultStr;
    }  

     /*
     * 保存临时数据
     */
    public function setData($fdataArr) {
        $this->dataArr = $fdataArr;
    }  
    
    /*
     * 获取临时数据
     */
    public function getData() {
        return $this->dataArr;        
    }   
    
    /*
     * 获取临时数据
     */
    public function getPropertyFromData($propName) {
        return isset($this->dataArr[$propName])?$this->dataArr[$propName]:'';     
    }  
    
    
}
